package de.wefunkdroid.core.data;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

public class Show {

	String num;
	String date;
	ArrayList<Track> tracks;

	public Show() {
		num = "-1";
		date = "0-0-0";
		tracks = new ArrayList<Track>();
		tracks.add(new Track("WeFunk Crew", "Intro", "0"));
	}

	public Show(String num, String date) {
		num = num.replaceAll(">", "");
		this.num = num;
		this.date = date;
		tracks = new ArrayList<Track>();
		tracks.add(new Track("WeFunk Crew", "Intro", "0"));
	}

	public Show(String num, String date, ArrayList<Track> tracks) {
		this.num = num;
		this.date = date;
		this.tracks = tracks;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String getNum() {
		return num;
	}

	public void setNum(String num) {
		num = num.replaceAll(">", "");
		this.num = num;
	}

	public ArrayList<Track> getTracks() {
		return tracks;
	}

	public void setTracks(ArrayList<Track> tracks) {
		this.tracks = tracks;
	}

	@SuppressWarnings("unchecked")
	public void addTrack(Track t) {
		tracks.add(t);
		Collections.sort(tracks);
	}

	public void remTrack(Track t) {
		tracks.remove(t);
	}

	public String toString() {
		String res = "";
		for (Iterator<Track> iterator = tracks.iterator(); iterator.hasNext();) {
			Track t = (Track) iterator.next();
			res = (new StringBuilder(String.valueOf(res))).append(t).append(
					"; ").toString();
		}

		return (new StringBuilder("Date: ")).append(date).append(" Num: ")
				.append(num).append(" Tracks: ").append(res).toString();
	}
}
